package com.briup.pts.web.controller;

import com.briup.pts.config.response.Result;
import com.briup.pts.domain.vo.SourceVO;
import com.briup.pts.service.SourceService;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import lombok.RequiredArgsConstructor;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@Tag(name = "动物扫码溯源模块")
@RestController
@RequestMapping("/source")
@RequiredArgsConstructor
public class SourceController {

    private final SourceService service;

    @Operation(summary = "扫码查询对应id动物的所有相关数据")
    @GetMapping("/{animalId}")
    public Result<SourceVO> source(@PathVariable String animalId){
        SourceVO sourceVO = service.queryByAnimalId(animalId);
        return Result.success(sourceVO);
    }
}
